<%--
  User: sam
  Date: 2019/1/21
  Time: 9:48
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>项目列表</title>
    <style>
        div {
            width: 800px;
            height: 800px;
            margin: 0 auto;
            border: 1px solid black;
        }

        form {
            margin-left: 30px;
            margin-top: 10px;
        }

        table {
            width: 100%;
        }

        p {
            text-align: center;
        }
    </style>
</head>
<body>
<%--如果列表为空，自动跳转到/index--%>
<%--<c:if test="${empty projectInfoList}">--%>
    <%--<c:redirect url="/index"/>--%>
<%--</c:if>--%>

<div>
    <form action="${pageContext.request.contextPath}/index">
        申报状态: <select name="status">
        <option value="99" ${status == 99?"selected":""} >全部</option>
        <option value="0" ${status == 0?"selected":""} >已申报</option>
        <option value="1" ${status == 1?"selected":""} >审核中</option>
        <option value="2" ${status == 2?"selected":""} >已审核</option>
    </select> <input type="submit" value="查询">
    </form>
    <hr>

    <table border="1">
        <thead>
        <tr>
            <th>编号</th>
            <th>项目名称</th>
            <th>开始时间</th>
            <th>结束时间</th>
            <th>项目状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${projectInfoList}" var="projectInfo">
            <tr>
                <td>${projectInfo.id}</td>
                <td>${projectInfo.projectName}</td>
                <td><fmt:formatDate value="${projectInfo.startDate}" pattern="yyyy-MM-dd"/></td>
                <td><fmt:formatDate value="${projectInfo.endDate}" pattern="yyyy-MM-dd"/></td>
                <td>${projectInfo.switchStatus}</td>
                <td>
                    <c:if test="${projectInfo.status != 2}">
                        <a href="${pageContext.request.contextPath}/show?id=${projectInfo.id}">审核</a>
                    </c:if>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>

    <hr>
    <p>${resultMsg}</p>


</div>

</body>
</html>
